@tool
extends Area2D

@export var next_path:PackedScene:
	set(path):
		if next_path != path:
			next_path = path
			update_configuration_warnings()
			
func _on_body_entered(_player):
	if next_path != null:
		Global.go_to_world(next_path)
	else:
		Global.complete_game()

func _get_configuration_warnings():
	var warnings = []
	if next_path == null:
		warnings.append("Please set next_path` to a non-empty value.")

	# Returning an empty array means "no warning".
	return warnings
